Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak of a CGPathRef #1649

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

greghe
Copy link

@greghe greghe commented Sep 30, 2021

Summary

Regarding issue #1385
Fixes memory leak of a CGPathRef.

Explain the motivation for making this change: here are some points to help you:

CGPath leaks listed in Xcode:

leaked objects

Backtrace of leaked object, identifying RNSVGUse as the object that leaked the CGPathRef:

svg leak

  • What issues does the pull request solve? Please tag them so that they will get automatically closed once the PR is merged
    Issue Memory leaks in RNSVGUse getPath?  #1385

  • What is the feature? (if applicable)
    Memory leak fix

  • How did you implement the solution?
    Added a call to autorelease returned CGPathRef in line with the other implementations of getPath:

  • What areas of the library does it impact?

Test Plan

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

What's required for testing (prerequisites)?

Running an app that uses react-native-svg in the Xcode debugger with malloc stack tracing enabled.

What are the steps to reproduce (after prerequisites)?

Halt the app in the debugger and examine memory graph, specifically the leaked objects filter (by clicking on the blue triangle icon)

directions

Compatibility

OS Implemented
iOS
Android

Checklist

  • I have tested this on a device and a simulator
  • I added documentation in README.md
  • I updated the typed files (typescript)
  • I added a test for the API in the __tests__ folder

@greghe greghe changed the title Fix memory leak when return CGPathRef Fix memory leak of a CGPathRef Sep 30, 2021
@Arjan-Zuidema
Copy link

Would be awesome if this could get merged. We are also experiencing this issue. Looks like a simple fix?

@markrickert
Copy link

I'd love to remove my local patch for this fix. Any idea when this will make it into a release?

@efstathiosntonas
Copy link

@javache hi, is there any reason why this is not merged yet? Thanks

@bohdanprog
Copy link
Member

bohdanprog commented Jul 3, 2024

Hi, Could someone explain how we can reproduce that nowadays?
We want to reproduce that memory leak.
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants